<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增商品分类管理')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-systematics-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">商品分类启用状态，1表示启用0表示禁用：</label>
                <div class="col-sm-8">
                    <div class="radio-box">
                        <input type="radio" name="enableStatus" value="" required>
                        <label th:for="enableStatus" th:text="未知"></label>
                    </div>
                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">商品分类等级，1表示一级，2表示二级，3表示三级：</label>
                <div class="col-sm-8">
                    <input name="classificationLevel" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">商品分类名称：</label>
                <div class="col-sm-8">
                    <input name="typeName" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">商品分类图片：</label>
                <div class="col-sm-8">
                    <input name="typeImg" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">商品排序数字：</label>
                <div class="col-sm-8">
                    <input name="sortNum" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">商品分类描述：</label>
                <div class="col-sm-8">
                    <input name="typeDesc" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">商品分类路径：</label>
                <div class="col-sm-8">
                    <input name="systematicsPath" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">父分类：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input id="treeId" name="parentId" type="hidden" th:value="${goodsSystematics?.systematicsId}"/>
                        <input class="form-control" type="text" onclick="selectSystematicsTree()" id="treeName" readonly="true" th:value="${goodsSystematics?.typeName}" required>
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/systematics"
        $("#form-systematics-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-systematics-add').serialize());
            }
        }

        /*商品分类管理-新增-选择父部门树*/
        function selectSystematicsTree() {
            var options = {
                title: '商品分类管理选择',
                width: "380",
                url: prefix + "/selectSystematicsTree/" + $("#treeId").val(),
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }

        function doSubmit(index, layero){
            var body = layer.getChildFrame('body', index);
               $("#treeId").val(body.find('#treeId').val());
               $("#treeName").val(body.find('#treeName').val());
               layer.close(index);
        }
    </script>
</body>
</html>